package com.jl.mapper;

import com.jl.model.User;
import com.jl.model.vo.UserVo;
import com.jl.utils.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface AuthMapper extends MyMapper<User> {

    @Select("select id,open_id openId,nick_name nickName,sex,head_img_url headImgUrl,user_role userRole,coin,phone from user where open_id=#{openId}")
    User selectUserInfo(@Param("openId") String openId);

    @Select("select id,open_id openId,phone,nick_name nickName,head_img_url headImgUrl,user_role userRole,coin from user where phone=#{phone} and password=#{password}")
    UserVo selectUserByPassword(@Param("phone") String phone,@Param("password") String password);

    @Select("select id,nick_name nickName,bank_name bankName,bank_no bankNo,alipay from user where id=#{userId} and (bank_no=#{account} or alipay=#{account})")
    User selectUserAccountInfo(@Param("userId") Integer userId, @Param("account")String account);
}
